﻿
var pid = 0;
$.fn.datebox.defaults.formatter = function (date) {
    var y = date.getFullYear();
    var m = date.getMonth() + 1;
    var d = date.getDate();
    return y + '/' + (m < 10 ? ('0' + m) : m) + '/' + (d < 10 ? ('0' + d) : d);
};
$.fn.datebox.defaults.parser = function (s) {
    if (!s) return new Date();
    var ss = s.split('/');
    var y = parseInt(ss[0], 10);
    var m = parseInt(ss[1], 10);
    var d = parseInt(ss[2], 10);
    if (!isNaN(y) && !isNaN(m) && !isNaN(d)) {
        return new Date(y, m - 1, d);
    } else {
        return new Date();
    }
};
$(function () {
    var h = $('#mytt').height();
    $('.myh').height(h - 50);
    InitCombox();
    InitGird();
    InitSearch();
});
function InitCombox() {
    //$('#sex,#nation,#marital,#health,#political').combobox({
    //    width: 150,
    //    panelHeight: 'auto',
    //    panelMaxHeight: 150        
    //});
    $('#sex').combobox({
        data: cbbsex,
        width: 150,
        panelMaxHeight: 150,
        panelHeight: 'auto',
        valueField: 'text',
        textField: 'text'
    });
    $('#nation').combobox({
        data: cbbnation,
        width: 150,
        panelHeight: 'auto',
        panelMaxHeight: 150,
        valueField: 'text',
        textField: 'text'
    });

    $('#political').combobox({
        data: cbbpolitical,
        width: 150,
        panelHeight: 'auto',
        panelMaxHeight: 150,
        valueField: 'text',
        textField: 'text'
    });

    $('#health').combobox({
        data: cbbhealth,
        width: 150,
        panelHeight: 'auto',
        panelMaxHeight: 150,
        valueField: 'text',
        textField: 'text'
    });
    $('#workjgtype,#fjgtype').combobox({
        data: jgtype,
        width: 150,
        panelHeight: 'auto',
        panelMaxHeight: 150,
        valueField: 'text',
        textField: 'text'
    });
    $('#workjjtype,#fjjtype').combobox({
        data: jjtype,
        width: 150,
        panelMaxHeight: 150,
        panelHeight: 'auto',
        valueField: 'text',
        textField: 'text'
    });
    $('#worktrade,#ftrade').combobox({
        data: cbtrade,
        width: 150,
        panelMaxHeight: 150,
        panelHeight: 'auto',
        valueField: 'text',
        textField: 'text'
    });
    $('#workarea,#hjarea,#farea,#oldarea,#newarea').combobox({
        data: cbcity,
        width: 150,
        panelHeight: 'auto',
        panelMaxHeight: 150,
        valueField: 'text',
        textField: 'text'
    });
    $('#degree,#edudegree').combobox({
        data: cbdegree,
        width: 150,
        panelHeight: 'auto',
        panelMaxHeight: 150,
        valueField: 'text',
        textField: 'text'
    });
    $('#education,#education').combobox({
        data: cbedu,
        width: 150,
        panelHeight: 'auto',
        panelMaxHeight: 150,
        valueField: 'text',
        textField: 'text'
    });

    $('#edumajortype').combobox({
        data: cbbedumajortype,
        width: 150,
        panelHeight: 'auto',
        panelMaxHeight: 150,
        valueField: 'text',
        textField: 'text'
    });
    $('#workjobtype').combobox({
        data: cbbworkjobtype,
        width: 150,
        panelHeight: 'auto',
        panelMaxHeight: 150,
        valueField: 'text',
        textField: 'text'
    });
    $('#rname').combobox({
        data: cbbrname,
        width: 150,
        panelHeight: 'auto',
        panelMaxHeight: 150,
        valueField: 'text',
        textField: 'text'
    });
    $('#puname').combobox({
        data: cbbpname,
        width: 150,
        panelHeight: 'auto',
        panelMaxHeight: 150,
        valueField: 'text',
        textField: 'text'
    });
    $('#marital').combobox({
        data: cbbmarital,
        width: 150,
        panelHeight: 'auto',
        panelMaxHeight: 150,
        valueField: 'text',
        textField: 'text'
    });
    $('#llevel').combobox({
        data: cbbllevel,
        width: 150,
        panelHeight: 'auto',
        panelMaxHeight: 150,
        valueField: 'text',
        textField: 'text'
    });

    $('#frelation').combobox({
        data: cbbfrelation,
        width: 150,
        panelHeight: 'auto',
        panelMaxHeight: 150,
        valueField: 'text',
        textField: 'text'
    });

    $('#fstatus').combobox({
        data: cbbfstatus,
        width: 150,
        panelHeight: 'auto',
        panelMaxHeight: 150,
        valueField: 'text',
        textField: 'text'
    });

    $('#ftype').combobox({
        data: cbbftype,
        width: 150,
        panelHeight: 'auto',
        panelMaxHeight: 150,
        valueField: 'text',
        textField: 'text'
    });

    $('#inreason').combobox({
        data: cbbinreason,
        width: 150,
        panelHeight: 'auto',
        panelMaxHeight: 150,
        valueField: 'text',
        textField: 'text'
    });

    $('#outreason').combobox({
        data: cbboutreason,
        width: 150,
        panelHeight: 'auto',
        panelMaxHeight: 150,
        valueField: 'text',
        textField: 'text'
    });

    $('#tlevel').combobox({
        data: cbbtlevel,
        width: 150,
        panelHeight: 'auto',
        panelMaxHeight: 150,
        valueField: 'text',
        textField: 'text'
    });
    $('#jlevel').combobox({
        data: cbbjlevel,
        width: 150,
        panelHeight: 'auto',
        panelMaxHeight: 150,
        valueField: 'text',
        textField: 'text'
    });
    $('#edutype').combobox({
        data: cbbedutype,
        width: 150,
        panelHeight: 'auto',
        panelMaxHeight: 150,
        valueField: 'text',
        textField: 'text'
    });
    $('#stutype').combobox({
        data: cbbstutype,
        width: 150,
        panelHeight: 'auto',
        panelMaxHeight: 150,
        valueField: 'text',
        textField: 'text'
    });
    $('#plno').combobox({
        url: '/pictypeinfo/GetPt.ashx?action=ddllist',
        valueField: 'ptid',
        textField: 'ptname',
        width: 150,
        panelHeight: 'auto',
        onSelect: function (row) {
            if (row != null) {
                //$('#plnocn').val(row.ptname);
                $('#plnameid').combobox({
                    url: "/pictypeinfo/GetPt.ashx?action=ddllist&id=" + row.ptid,
                    valueField: 'ptid',
                    width: 150,
                    textField: 'ptname',
                    panelHeight: 'auto'
                });
            }
        }
    });
}
//初始化表格
function InitGird() {
    $('#tt').datagrid({
        title: '档案列表', //表格标题
        url: 'GetP.ashx', //请求数据的页面
        sortName: 'pname', //排序字段
        idField: 'pid', //标识字段,主键
        iconCls: '', //标题左边的图标
        width: '100%', //宽度
        //height: $(parent.document).find("#mainPanle").height() - 35 > 0 ? $(parent.document).find("#mainPanle").height() - 35 : 500, //高度
        nowrap: false, //是否换行，True 就会把数据显示在一行里
        striped: true, //True 奇偶行使用不同背景色
        collapsible: false, //可折叠
        sortOrder: 'desc', //排序类型
        remoteSort: true, //定义是否从服务器给数据排序
        fitColumns: true,
        singleSelect: true,
        method: 'post',
        columns: [[
            { field: 'ckb', checkbox: true },
            { title: '姓名', field: 'pname', width: 80, sortable: true },
            { title: '曾用名', field: 'zname', width: 80 },
            { title: '身份证', field: 'ID', width: 150 },
            { title: '性别', field: 'sex', width: 50 },
            { title: '邮箱', field: 'email', width: 150 },
            { title: '手机', field: 'phnoe', width: 100 },
            { title: '地址', field: 'address', width: 200 },
            { title: '存档地址', field: 'kuname', width: 200 },
            {
                title: '档案目录', field: 'ppp', width: 100, formatter: function (value, row, index) {
                    return "<a onclick='openpl(" + row.pid + ",\"" + row.pname + "\")' href='#' >目录录入</a>";
                }
            }
        ]],
        toolbar: "#tab_toolbar",
        queryParams: { "action": "query" },
        pagination: true, //是否开启分页
        pageNumber: 1, //默认索引页
        pageSize: 20, //默认一页数据条数
        rownumbers: true //行号
    });


}

//初始化搜索框
function InitSearch() {
    $("#ipt_search").searchbox({
        width: 200,
        //iconCls: 'icon-save',
        searcher: function (val, name) {
            $('#tt').datagrid('options').queryParams.search_type = name;
            $('#tt').datagrid('options').queryParams.search_value = val;
            $('#tt').datagrid('reload');
        },
        prompt: '请输入查询信息'
    });

}
function newUser() {
    //清空内容  
    $('#fm').form('clear');
    $('#dlg').dialog('open').dialog('setTitle', '添加');
    document.getElementById("test").value = "add";
    $('#nation').combobox('setValue', '汉族');
    $('#marital').combobox('setValue', '未婚');
    $('#health').combobox('setValue', '健康或良好');
    $('#political').combobox('setValue', '群众');
    $('#sex').combobox('setValue', '男性');

}

//修改管理员  
function editUser() {

    var row = $('#tt').datagrid('getSelected');
    if (row == null) {
        $.messager.alert("提示", "请选择要修改的行！", "info");
    }


    if (row) {
        $('#dlg').dialog('open').dialog('setTitle', '修改');
        $('#uid').val(row.uid);
        document.getElementById("test").value = "modify";
        $('#fm').form('load', row);

    }
}
//添加        
function saveUser() {
    $('#workarea').combobox('setValue', $('#workarea').combobox('getText'));
    $('#hjarea').combobox('setValue', $('#hjarea').combobox('getText'));
    $('#farea').combobox('setValue', $('#farea').combobox('getText'));
    $('#oldarea').combobox('setValue', $('#oldarea').combobox('getText'));
    $('#newarea').combobox('setValue', $('#newarea').combobox('getText'));
    var test = document.getElementById("test").value;
    var f = $('#fm');
    if (test == "add") {
        f.form('submit', {
            url: "GetP.ashx?action=" + test,
            onSubmit: function () {
                //return $(this).form('validate');

                return true;
            },
            success: function (result) {
                if (result.indexOf("T") == 0) {
                    $('#dlg').dialog('close');
                    $.messager.alert("提示", "恭喜您，信息添加成功", "info");
                    $('#tt').datagrid('reload');
                }
                else if ((result.indexOf("F") == 0)) {
                    $.messager.alert("提示", "添加失败，请重新操作！", "info");
                    return;
                }
                else if ((result.indexOf("L") == 0)) {
                    $.messager.alert("提示", "长时间没有操作，请重新登录！", "info");
                    top.location = '/Default.aspx';
                    return;
                }
            }
        });

    } else {

        $('#fm').form('submit', {
            url: "GetP.ashx?action=" + test,
            onSubmit: function () {
                //return $(this).form('validate');
                return true;
            },
            success: function (result) {
                if (result.indexOf("T") == 0) {
                    $('#dlg').dialog('close');
                    $('#tt').datagrid('clearSelections');
                    $.messager.alert("提示", "恭喜您，信息修改成功", "info");
                    $('#tt').datagrid('reload');

                }
                else if ((result.indexOf("F") == 0)) {
                    $.messager.alert("提示", "添加失败，请重新操作！", "info");
                    return;
                }
                else if ((result.indexOf("L") == 0)) {
                    $.messager.alert("提示", "长时间没有操作，请重新登录！", "info");
                    top.location = '/Default.aspx';
                    return;
                }
            }
        });
    }
}
function removeUser() {
    var test = document.getElementById("test").value = "delete";
    var row = $('#tt').datagrid('getSelected');
    if (row == null) {
        $.messager.alert("提示", "请选择要删除的行！", "info");
    }
    if (row) {
        $.messager.confirm('提示', '你确定要删除这条信息吗？', function (r) {
            if (r) {
                if (r.drelation == '1') {
                    $.messager.alert("提示", "用户有党团关系不能删除！", "info");
                    return;
                }
                if (r.hrelation == '1') {
                    $.messager.alert("提示", "用户有户籍关系不能删除！", "info");
                    return;
                }
                if (r.sbrelation == '1') {
                    $.messager.alert("提示", "用户有社保关系不能删除！", "info");
                    return;
                }
                $('#fm').form('submit', {
                    url: 'GetP.ashx?uid=' + row.pid + "&action=" + test,
                    onSubmit: function () {
                        //return $(this).form('validate');  
                    },
                    success: function (result) {
                        if (result.indexOf("T") == 0) {
                            $('#dlg').dialog('close');
                            $('#tt').datagrid('clearSelections'); //清空选中的行  
                            $.messager.alert("提示", "恭喜您，信息删除成功！", "info");
                            //alert('恭喜您，信息删除成功！')  
                            // close the dialog  
                            $('#tt').datagrid('reload');
                            //$('#fm').form('submit');

                        }
                        else if ((result.indexOf("F") == 0)) {
                            $.messager.alert("提示", "删除失败，请重新操作！", "info");
                            return;
                        }
                        else if ((result.indexOf("L") == 0)) {
                            $.messager.alert("提示", "长时间没有操作，请重新登录！", "info");
                            top.location = '/Default.aspx';
                            return;
                        }

                    }

                });
            }
        })
    }
}
function openpic(rpid, pname) {
    pid = rpid;
    InitPictype()
    $('#dlgpi').dialog('open').dialog('setTitle', pname + '材料管理');
    InitGirdpic();
}
function openku(rpid, pname, kuname) {
    pid = rpid;
    $('#dlgku').dialog('open').dialog('setTitle', pname + '存档管理');
    $('#kuname').html(kuname);
    InitTree();
}
function openpl(rpid, pname) {
    pid = rpid;
    $('#dlgplist').dialog('open').dialog('setTitle', pname + '档案目录管理');
    InitGirdpl();
}
function InitGirdpl() {
    $('#ttpl').datagrid({
        title: '列表', //表格标题
        url: 'GetPL.ashx', //请求数据的页面
        sortName: 'plid', //排序字段
        idField: 'plid', //标识字段,主键
        iconCls: '', //标题左边的图标
        width: '100%', //宽度
        height: '100%',
        nowrap: false, //是否换行，True 就会把数据显示在一行里
        striped: true, //True 奇偶行使用不同背景色
        collapsible: false, //可折叠
        singleSelect: true,
        sortOrder: 'desc', //排序类型
        remoteSort: true, //定义是否从服务器给数据排序
        fitColumns: true,
        method: 'post',
        columns: [[
            { field: 'ckb', checkbox: true },
                       { title: '档案目录', field: 'plid', width: 150 },
           { title: '类号', field: 'plnocn', width: 150 },
           { title: '材料目录', field: 'plnamecn', width: 150 },
           { title: '制成时间', field: 'pldate', width: 150, formatter: function (value, row, index) { if (value != "") { if (value.indexOf("-") != -1) value = value.replace(/-/g, "/"); return new Date(value).pattern("yyyy年M月d日"); } } },
           { title: '份数', field: 'copynum', width: 150 },
           { title: '页数', field: 'pagenum', width: 150 },
           { title: '备注', field: 'plmark', width: 150 }

        ]],
        toolbar: "#tab_toolbarpl",
        queryParams: { "action": "query", "pid": pid },
        pagination: true, //是否开启分页
        pageNumber: 1, //默认索引页
        pageSize: 20, //默认一页数据条数
        rownumbers: true //行号
    });


}

function outExcel() {  
    $('#fmout').form('submit', {
        url: 'GetP.ashx?action=outFP',
        onSubmit: function () {
            //return $(this).form('validate');  
        },
        success: function (result) {
            if (result.length > 2) {
                var bj = result.substr(0, 2);
                if (bj != "@@") {
                    $("#downurl").attr("href", result);
                    $("#showout").show();
                    $.messager.alert("提示", "导出成功，请点击下载！", "info");
                }
                else {
                    var t = result.substr(2, result.length - 2);
                    $.messager.alert("提示", t, "info");
                }
            }
        }

    });

}

function newUserpl() {
    //清空内容  
    $('#fmpl').form('clear');
    $('#pid').val(pid);
    $('#dlgpl').dialog('open').dialog('setTitle', '添加');
    document.getElementById("test").value = "add";
}

function editUserpl() {
    var row = $('#ttpl').datagrid('getSelected');
    if (row == null) {
        $.messager.alert("提示", "请选择要修改的行！", "info");
    }
    if (row) {
        $('#dlgpl').dialog('open').dialog('setTitle', '修改');
        $('#plid').val(row.plid);
        document.getElementById("test").value = "modify";
        $('#fmpl').form('load', row);
    }
}
//添加        
function saveUserpl() {
    var test = document.getElementById("test").value;
    var f = $('#fmpl');
    if (test == "add") {
        f.form('submit', {
            url: "GetPL.ashx?pid=" + pid + "&action=" + test,
            onSubmit: function () {
                return $(this).form('validate');
            },
            success: function (result) {
                if (result.indexOf("T") == 0) {
                    $('#dlgpl').dialog('close');
                    $.messager.alert("提示", "恭喜您，信息添加成功", "info");
                    $('#ttpl').datagrid('reload');
                }
                else if ((result.indexOf("F") == 0)) {
                    $.messager.alert("提示", "添加失败，请重新操作！", "info");
                    return;
                }
                else if ((result.indexOf("L") == 0)) {
                    $.messager.alert("提示", "长时间没有操作，请重新登录！", "info");
                    top.location = '/index.aspx';
                    return;
                }
            }
        });

    } else {

        f.form('submit', {
            url: "GetPL.ashx?pid=" + pid + "&action=" + test,
            onSubmit: function () {
                return $(this).form('validate');
            },
            success: function (result) {
                if (result.indexOf("T") == 0) {
                    $('#dlgpl').dialog('close');
                    $('#ttpl').datagrid('clearSelections');
                    $.messager.alert("提示", "恭喜您，信息修改成功", "info");
                    $('#ttpl').datagrid('reload');

                }
                else if ((result.indexOf("F") == 0)) {
                    $.messager.alert("提示", "添加失败，请重新操作！", "info");
                    return;
                }
                else if ((result.indexOf("L") == 0)) {
                    $.messager.alert("提示", "长时间没有操作，请重新登录！", "info");
                    top.location = '/index.aspx';
                    return;
                }
            }
        });
    }
}

function removeUserpl() {
    var test = document.getElementById("test").value = "delete";
    var row = $('#ttpl').datagrid('getSelected');
    if (row == null) {
        $.messager.alert("提示", "请选择要删除的行！", "info");
    }
    if (row) {
        $.messager.confirm('提示', '你确定要删除这条信息吗？', function (r) {
            if (r) {
                $('#fmpl').form('submit', {
                    url: 'GetPL.ashx' + '?plid=' + row.plid + "&action=" + test,
                    onSubmit: function () {
                        //return $(this).form('validate');  
                    },
                    success: function (result) {
                        if (result.indexOf("T") == 0) {
                            $('#dlgpl').dialog('close');
                            $('#ttpl').datagrid('clearSelections'); //清空选中的行  
                            $.messager.alert("提示", "恭喜您，信息删除成功！", "info");
                            $('#ttpl').datagrid('reload');

                        }
                        else if ((result.indexOf("F") == 0)) {
                            $.messager.alert("提示", "添加失败，请重新操作！", "info");
                            return;
                        }
                        else if ((result.indexOf("L") == 0)) {
                            $.messager.alert("提示", "长时间没有操作，请重新登录！", "info");
                            top.location = '/index.aspx';
                            return;
                        }
                    }
                });
            }
        })
    }
}

function openther(rpid, pname) {
    pid = rpid;
    $('#dlgp').dialog('open').dialog('setTitle', pname + '其它信息管理');
    var h = $('#pwtt').height();
    $('#wtt').height(h - 40);
    $('#tett').height(h - 40);
    $('#jtt').height(h - 40);
    $('#ltt').height(h - 40);
    $('#ett').height(h - 40);
    $('#ftt').height(h - 40);
    $('#putt').height(h - 40);
    $('#rtt').height(h - 40);
    $('#ttt').height(h - 40);
    InitGirdw();
    InitGirdte();
    InitGirdj();
    InitGirdl();
    InitGirde();
    InitGirdf();
    InitGirdpu();
    InitGirdr();
    InitGirdt();
}
function InitGirdw() {
    $('#ttw').datagrid({
        //title: '工作经历列表', //表格标题
        url: 'GetWork.ashx', //请求数据的页面
        sortName: 'inputtime', //排序字段
        idField: 'wid', //标识字段,主键
        iconCls: '', //标题左边的图标
        width: '100%', //宽度
        height: '100%',
        nowrap: false, //是否换行，True 就会把数据显示在一行里
        striped: true, //True 奇偶行使用不同背景色
        collapsible: false, //可折叠
        sortOrder: 'desc', //排序类型
        remoteSort: true, //定义是否从服务器给数据排序
        fitColumns: true,
        singleSelect: true,
        method: 'post',
        columns: [[
            { field: 'ckb', checkbox: true },
            {
                title: '开始时间', field: 'sdate', width: 80, formatter: function (value, row, index) {
                    if (value != "") {

                        if (value.indexOf("-") != -1)
                            value = value.replace(/-/g, "/");
                        return new Date(value).pattern("yyyy年M月d日");
                    }
                }
            },
            {
                title: '结束时间', field: 'edate', width: 80, formatter: function (value, row, index) {
                    if (value != "") {

                        if (value.indexOf("-") != -1)
                            value = value.replace(/-/g, "/");
                        return new Date(value).pattern("yyyy年M月d日");
                    }
                }
            },
            { title: '单位名称', field: 'wname', width: 150 },
            { title: '工作/职务', field: 'wjob', width: 150 },
            { title: '证明人', field: 'zmname', width: 150 }
        ]],
        toolbar: "#tab_toolbarw",
        queryParams: { "action": "query", "pid": pid },
        pagination: true, //是否开启分页
        pageNumber: 1, //默认索引页
        pageSize: 20, //默认一页数据条数
        rownumbers: true //行号
    });
}
function newUserw() {
    //清空内容  
    $('#fmw').form('clear');
    $('#dlgw').dialog('open').dialog('setTitle', '添加');
    document.getElementById("testw").value = "add";

}

//修改管理员  
function editUserw() {

    var row = $('#ttw').datagrid('getSelected');
    if (row == null) {
        $.messager.alert("提示", "请选择要修改的行！", "info");
    }
    if (row) {
        $('#dlgw').dialog('open').dialog('setTitle', '修改');
        $('#wid').val(row.uid);
        document.getElementById("testw").value = "modify";
        $('#fmw').form('load', row);
    }
}
//添加        
function saveUserw() {
    var test = document.getElementById("testw").value;
    var f = $('#fmw');
    if (test == "add") {
        f.form('submit', {
            url: "GetWork.ashx?pid=" + pid + "&action=" + test,
            onSubmit: function () {
                return $(this).form('validate');
            },
            success: function (result) {
                if (result.indexOf("T") == 0) {
                    $('#dlgw').dialog('close');
                    $.messager.alert("提示", "恭喜您，信息添加成功", "info");
                    $('#ttw').datagrid('reload');
                }
                else if ((result.indexOf("F") == 0)) {
                    $.messager.alert("提示", "添加失败，请重新操作！", "info");
                    return;
                }
                else if ((result.indexOf("L") == 0)) {
                    $.messager.alert("提示", "长时间没有操作，请重新登录！", "info");
                    top.location = '/Default.aspx';
                    return;
                }
            }
        });

    } else {

        $('#fmw').form('submit', {
            url: "GetWork.ashx?action=" + test,
            onSubmit: function () {
                return $(this).form('validate');
            },
            success: function (result) {
                if (result.indexOf("T") == 0) {
                    $('#dlgw').dialog('close');
                    $('#ttw').datagrid('clearSelections');
                    $.messager.alert("提示", "恭喜您，信息修改成功", "info");
                    $('#ttw').datagrid('reload');

                }
                else if ((result.indexOf("F") == 0)) {
                    $.messager.alert("提示", "添加失败，请重新操作！", "info");
                    return;
                }
                else if ((result.indexOf("L") == 0)) {
                    $.messager.alert("提示", "长时间没有操作，请重新登录！", "info");
                    top.location = '/Default.aspx';
                    return;
                }
            }
        });
    }
}
function removeUserw() {
    var test = document.getElementById("testw").value = "delete";
    var row = $('#ttw').datagrid('getSelected');
    if (row == null) {
        $.messager.alert("提示", "请选择要删除的行！", "info");
    }
    if (row) {
        $.messager.confirm('提示', '你确定要删除这条信息吗？', function (r) {
            if (r) {
                $('#fmw').form('submit', {
                    url: 'GetWork.ashx?uid=' + row.wid + "&action=" + test,
                    onSubmit: function () {
                        //return $(this).form('validate');  
                    },
                    success: function (result) {
                        if (result.indexOf("T") == 0) {
                            $('#dlgw').dialog('close');
                            $('#ttw').datagrid('clearSelections'); //清空选中的行  
                            $.messager.alert("提示", "恭喜您，信息删除成功！", "info");
                            //alert('恭喜您，信息删除成功！')  
                            // close the dialog  
                            $('#ttw').datagrid('reload');
                            //$('#fm').form('submit');

                        }
                        else if ((result.indexOf("F") == 0)) {
                            $.messager.alert("提示", "删除失败，请重新操作！", "info");
                            return;
                        }
                        else if ((result.indexOf("L") == 0)) {
                            $.messager.alert("提示", "长时间没有操作，请重新登录！", "info");
                            top.location = '/Default.aspx';
                            return;
                        }

                    }

                });
            }
        })
    }
}
function InitGirdte() {
    $('#ttte').datagrid({
        //title: '工作经历列表', //表格标题
        url: 'GetTe.ashx', //请求数据的页面
        sortName: 'inputtime', //排序字段
        idField: 'tid', //标识字段,主键
        iconCls: '', //标题左边的图标
        width: '100%', //宽度
        height: '100%',
        nowrap: false, //是否换行，True 就会把数据显示在一行里
        striped: true, //True 奇偶行使用不同背景色
        collapsible: false, //可折叠
        sortOrder: 'desc', //排序类型
        remoteSort: true, //定义是否从服务器给数据排序
        fitColumns: true,
        singleSelect: true,
        method: 'post',
        columns: [[
            { field: 'ckb', checkbox: true },
            { title: '名称', field: 'tname', width: 150 },
            { title: '级别', field: 'tlevel', width: 150 },
            {
                title: '获得时间', field: 'tdate', width: 80, formatter: function (value, row, index) {
                    if (value != "") {

                        if (value.indexOf("-") != -1)
                            value = value.replace(/-/g, "/");
                        return new Date(value).pattern("yyyy年M月d日");
                    }
                }
            }
        ]],
        toolbar: "#tab_toolbarte",
        queryParams: { "action": "query", "pid": pid },
        pagination: true, //是否开启分页
        pageNumber: 1, //默认索引页
        pageSize: 20, //默认一页数据条数
        rownumbers: true //行号
    });
}
function newUserte() {
    //清空内容  
    $('#fmte').form('clear');
    $('#dlgte').dialog('open').dialog('setTitle', '添加');
    document.getElementById("testte").value = "add";

}

//修改管理员  
function editUserte() {

    var row = $('#ttte').datagrid('getSelected');
    if (row == null) {
        $.messager.alert("提示", "请选择要修改的行！", "info");
    }
    if (row) {
        $('#dlgte').dialog('open').dialog('setTitle', '修改');
        //$('#tid').val(row.tid);
        document.getElementById("testte").value = "modify";
        $('#fmte').form('load', row);
    }
}
//添加        
function saveUserte() {
    var test = document.getElementById("testte").value;
    var f = $('#fmte');
    if (test == "add") {
        f.form('submit', {
            url: "GetTe.ashx?pid=" + pid + "&action=" + test,
            onSubmit: function () {
                return $(this).form('validate');
            },
            success: function (result) {
                if (result.indexOf("T") == 0) {
                    $('#dlgte').dialog('close');
                    $.messager.alert("提示", "恭喜您，信息添加成功", "info");
                    $('#ttte').datagrid('reload');
                }
                else if ((result.indexOf("F") == 0)) {
                    $.messager.alert("提示", "添加失败，请重新操作！", "info");
                    return;
                }
                else if ((result.indexOf("L") == 0)) {
                    $.messager.alert("提示", "长时间没有操作，请重新登录！", "info");
                    top.location = '/Default.aspx';
                    return;
                }
            }
        });

    } else {

        $('#fmte').form('submit', {
            url: "GetTe.ashx?action=" + test,
            onSubmit: function () {
                return $(this).form('validate');
            },
            success: function (result) {
                if (result.indexOf("T") == 0) {
                    $('#dlgte').dialog('close');
                    $('#ttte').datagrid('clearSelections');
                    $.messager.alert("提示", "恭喜您，信息修改成功", "info");
                    $('#ttte').datagrid('reload');

                }
                else if ((result.indexOf("F") == 0)) {
                    $.messager.alert("提示", "添加失败，请重新操作！", "info");
                    return;
                }
                else if ((result.indexOf("L") == 0)) {
                    $.messager.alert("提示", "长时间没有操作，请重新登录！", "info");
                    top.location = '/Default.aspx';
                    return;
                }
            }
        });
    }
}
function removeUserte() {
    var test = document.getElementById("testte").value = "delete";
    var row = $('#ttte').datagrid('getSelected');
    if (row == null) {
        $.messager.alert("提示", "请选择要删除的行！", "info");
    }
    if (row) {
        $.messager.confirm('提示', '你确定要删除这条信息吗？', function (r) {
            if (r) {
                $('#fmte').form('submit', {
                    url: 'GetTe.ashx?uid=' + row.tid + "&action=" + test,
                    onSubmit: function () {
                        //return $(this).form('validate');  
                    },
                    success: function (result) {
                        if (result.indexOf("T") == 0) {
                            $('#dlgte').dialog('close');
                            $('#ttte').datagrid('clearSelections'); //清空选中的行  
                            $.messager.alert("提示", "恭喜您，信息删除成功！", "info");
                            //alert('恭喜您，信息删除成功！')  
                            // close the dialog  
                            $('#ttte').datagrid('reload');
                            //$('#fm').form('submit');

                        }
                        else if ((result.indexOf("F") == 0)) {
                            $.messager.alert("提示", "删除失败，请重新操作！", "info");
                            return;
                        }
                        else if ((result.indexOf("L") == 0)) {
                            $.messager.alert("提示", "长时间没有操作，请重新登录！", "info");
                            top.location = '/Default.aspx';
                            return;
                        }

                    }

                });
            }
        })
    }
}

function InitGirdj() {
    $('#ttj').datagrid({
        //title: '工作经历列表', //表格标题
        url: 'GetJob.ashx', //请求数据的页面
        sortName: 'inputtime', //排序字段
        idField: 'jid', //标识字段,主键
        iconCls: '', //标题左边的图标
        width: '100%', //宽度
        height: '100%',
        nowrap: false, //是否换行，True 就会把数据显示在一行里
        striped: true, //True 奇偶行使用不同背景色
        collapsible: false, //可折叠
        sortOrder: 'desc', //排序类型
        remoteSort: true, //定义是否从服务器给数据排序
        fitColumns: true,
        singleSelect: true,
        method: 'post',
        columns: [[
            { field: 'ckb', checkbox: true },
            { title: '名称', field: 'jname', width: 150 },
            { title: '级别', field: 'jlevel', width: 150 },
            {
                title: '获得时间', field: 'jdate', width: 80, formatter: function (value, row, index) {
                    if (value != "") {

                        if (value.indexOf("-") != -1)
                            value = value.replace(/-/g, "/");
                        return new Date(value).pattern("yyyy年M月d日");
                    }
                }
            }
        ]],
        toolbar: "#tab_toolbarj",
        queryParams: { "action": "query", "pid": pid },
        pagination: true, //是否开启分页
        pageNumber: 1, //默认索引页
        pageSize: 20, //默认一页数据条数
        rownumbers: true //行号
    });
}
function newUserj() {
    //清空内容  
    $('#fmj').form('clear');
    $('#dlgj').dialog('open').dialog('setTitle', '添加');
    document.getElementById("testj").value = "add";

}

//修改管理员  
function editUserj() {

    var row = $('#ttj').datagrid('getSelected');
    if (row == null) {
        $.messager.alert("提示", "请选择要修改的行！", "info");
    }
    if (row) {
        $('#dlgj').dialog('open').dialog('setTitle', '修改');
        //$('#jid').val(row.jid);
        document.getElementById("testj").value = "modify";
        $('#fmj').form('load', row);
    }
}
//添加        
function saveUserj() {
    var test = document.getElementById("testj").value;
    var f = $('#fmj');
    if (test == "add") {
        f.form('submit', {
            url: "GetJob.ashx?pid=" + pid + "&action=" + test,
            onSubmit: function () {
                return $(this).form('validate');
            },
            success: function (result) {
                if (result.indexOf("T") == 0) {
                    $('#dlgj').dialog('close');
                    $.messager.alert("提示", "恭喜您，信息添加成功", "info");
                    $('#ttj').datagrid('reload');
                }
                else if ((result.indexOf("F") == 0)) {
                    $.messager.alert("提示", "添加失败，请重新操作！", "info");
                    return;
                }
                else if ((result.indexOf("L") == 0)) {
                    $.messager.alert("提示", "长时间没有操作，请重新登录！", "info");
                    top.location = '/Default.aspx';
                    return;
                }
            }
        });

    } else {

        $('#fmj').form('submit', {
            url: "GetJob.ashx?action=" + test,
            onSubmit: function () {
                return $(this).form('validate');
            },
            success: function (result) {
                if (result.indexOf("T") == 0) {
                    $('#dlgj').dialog('close');
                    $('#ttj').datagrid('clearSelections');
                    $.messager.alert("提示", "恭喜您，信息修改成功", "info");
                    $('#ttj').datagrid('reload');

                }
                else if ((result.indexOf("F") == 0)) {
                    $.messager.alert("提示", "添加失败，请重新操作！", "info");
                    return;
                }
                else if ((result.indexOf("L") == 0)) {
                    $.messager.alert("提示", "长时间没有操作，请重新登录！", "info");
                    top.location = '/Default.aspx';
                    return;
                }
            }
        });
    }
}
function removeUserj() {
    var test = document.getElementById("testj").value = "delete";
    var row = $('#ttj').datagrid('getSelected');
    if (row == null) {
        $.messager.alert("提示", "请选择要删除的行！", "info");
    }
    if (row) {
        $.messager.confirm('提示', '你确定要删除这条信息吗？', function (r) {
            if (r) {
                $('#fmj').form('submit', {
                    url: 'GetJob.ashx?uid=' + row.jid + "&action=" + test,
                    onSubmit: function () {
                        //return $(this).form('validate');  
                    },
                    success: function (result) {
                        if (result.indexOf("T") == 0) {
                            $('#dlgj').dialog('close');
                            $('#ttj').datagrid('clearSelections'); //清空选中的行  
                            $.messager.alert("提示", "恭喜您，信息删除成功！", "info");
                            //alert('恭喜您，信息删除成功！')  
                            // close the dialog  
                            $('#ttj').datagrid('reload');
                            //$('#fm').form('submit');

                        }
                        else if ((result.indexOf("F") == 0)) {
                            $.messager.alert("提示", "删除失败，请重新操作！", "info");
                            return;
                        }
                        else if ((result.indexOf("L") == 0)) {
                            $.messager.alert("提示", "长时间没有操作，请重新登录！", "info");
                            top.location = '/Default.aspx';
                            return;
                        }

                    }

                });
            }
        })
    }
}

function InitGirdl() {
    $('#ttl').datagrid({
        //title: '工作经历列表', //表格标题
        url: 'GetLan.ashx', //请求数据的页面
        sortName: 'inputtime', //排序字段
        idField: 'lid', //标识字段,主键
        iconCls: '', //标题左边的图标
        width: '100%', //宽度
        height: '100%',
        nowrap: false, //是否换行，True 就会把数据显示在一行里
        striped: true, //True 奇偶行使用不同背景色
        collapsible: false, //可折叠
        sortOrder: 'desc', //排序类型
        remoteSort: true, //定义是否从服务器给数据排序
        fitColumns: true,
        singleSelect: true,
        method: 'post',
        columns: [[
            { field: 'ckb', checkbox: true },
            { title: '名称', field: 'lname', width: 150 },
            { title: '级别', field: 'llevel', width: 150 }

        ]],
        toolbar: "#tab_toolbarl",
        queryParams: { "action": "query", "pid": pid },
        pagination: true, //是否开启分页
        pageNumber: 1, //默认索引页
        pageSize: 20, //默认一页数据条数
        rownumbers: true //行号
    });
}
function newUserl() {
    //清空内容  
    $('#fml').form('clear');
    $('#dlgl').dialog('open').dialog('setTitle', '添加');
    document.getElementById("testl").value = "add";

}

//修改管理员  
function editUserl() {

    var row = $('#ttl').datagrid('getSelected');
    if (row == null) {
        $.messager.alert("提示", "请选择要修改的行！", "info");
    }
    if (row) {
        $('#dlgl').dialog('open').dialog('setTitle', '修改');
        //$('#jid').val(row.jid);
        document.getElementById("testl").value = "modify";
        $('#fml').form('load', row);
    }
}
//添加        
function saveUserl() {
    var test = document.getElementById("testl").value;
    var f = $('#fml');
    if (test == "add") {
        f.form('submit', {
            url: "GetLan.ashx?pid=" + pid + "&action=" + test,
            onSubmit: function () {
                return $(this).form('validate');
            },
            success: function (result) {
                if (result.indexOf("T") == 0) {
                    $('#dlgl').dialog('close');
                    $.messager.alert("提示", "恭喜您，信息添加成功", "info");
                    $('#ttl').datagrid('reload');
                }
                else if ((result.indexOf("F") == 0)) {
                    $.messager.alert("提示", "添加失败，请重新操作！", "info");
                    return;
                }
                else if ((result.indexOf("L") == 0)) {
                    $.messager.alert("提示", "长时间没有操作，请重新登录！", "info");
                    top.location = '/Default.aspx';
                    return;
                }
            }
        });

    } else {

        $('#fml').form('submit', {
            url: "GetLan.ashx?action=" + test,
            onSubmit: function () {
                return $(this).form('validate');
            },
            success: function (result) {
                if (result.indexOf("T") == 0) {
                    $('#dlgl').dialog('close');
                    $('#ttl').datagrid('clearSelections');
                    $.messager.alert("提示", "恭喜您，信息修改成功", "info");
                    $('#ttl').datagrid('reload');

                }
                else if ((result.indexOf("F") == 0)) {
                    $.messager.alert("提示", "添加失败，请重新操作！", "info");
                    return;
                }
                else if ((result.indexOf("L") == 0)) {
                    $.messager.alert("提示", "长时间没有操作，请重新登录！", "info");
                    top.location = '/Default.aspx';
                    return;
                }
            }
        });
    }
}
function removeUserl() {
    var test = document.getElementById("testl").value = "delete";
    var row = $('#ttl').datagrid('getSelected');
    if (row == null) {
        $.messager.alert("提示", "请选择要删除的行！", "info");
    }
    if (row) {
        $.messager.confirm('提示', '你确定要删除这条信息吗？', function (r) {
            if (r) {
                $('#fml').form('submit', {
                    url: 'GetLan.ashx?uid=' + row.lid + "&action=" + test,
                    onSubmit: function () {
                        //return $(this).form('validate');  
                    },
                    success: function (result) {
                        if (result.indexOf("T") == 0) {
                            $('#dlgl').dialog('close');
                            $('#ttl').datagrid('clearSelections'); //清空选中的行  
                            $.messager.alert("提示", "恭喜您，信息删除成功！", "info");
                            //alert('恭喜您，信息删除成功！')  
                            // close the dialog  
                            $('#ttl').datagrid('reload');
                            //$('#fm').form('submit');

                        }
                        else if ((result.indexOf("F") == 0)) {
                            $.messager.alert("提示", "删除失败，请重新操作！", "info");
                            return;
                        }
                        else if ((result.indexOf("L") == 0)) {
                            $.messager.alert("提示", "长时间没有操作，请重新登录！", "info");
                            top.location = '/Default.aspx';
                            return;
                        }

                    }

                });
            }
        })
    }
}

function InitGirde() {
    $('#tte').datagrid({
        //title: '工作经历列表', //表格标题
        url: 'GetEdu.ashx', //请求数据的页面
        sortName: 'inputtime', //排序字段
        idField: 'eid', //标识字段,主键
        iconCls: '', //标题左边的图标
        width: '100%', //宽度
        height: '100%',
        nowrap: false, //是否换行，True 就会把数据显示在一行里
        striped: true, //True 奇偶行使用不同背景色
        collapsible: false, //可折叠
        sortOrder: 'desc', //排序类型
        remoteSort: true, //定义是否从服务器给数据排序
        fitColumns: true,
        singleSelect: true,
        method: 'post',
        columns: [[
            { field: 'ckb', checkbox: true },
            {
                title: '开始时间', field: 'sdate', width: 100, formatter: function (value, row, index) {
                    if (value != "") {

                        if (value.indexOf("-") != -1)
                            value = value.replace(/-/g, "/");
                        return new Date(value).pattern("yyyy年M月d日");
                    }
                }
            },
            {
                title: '结束时间', field: 'edate', width: 100, formatter: function (value, row, index) {
                    if (value != "") {

                        if (value.indexOf("-") != -1)
                            value = value.replace(/-/g, "/");
                        return new Date(value).pattern("yyyy年M月d日");
                    }
                }
            },
            { title: '所在学校', field: 'eschool', width: 150 },
            { title: '所学专业', field: 'edumajor', width: 150 },
            { title: '所获学位', field: 'edudegree', width: 80 },
            { title: '所获学历', field: 'education', width: 80 },
            { title: '教育类别', field: 'edutype', width: 80 },
            { title: '学习形式', field: 'stutype', width: 80 }

        ]],
        toolbar: "#tab_toolbare",
        queryParams: { "action": "query", "pid": pid },
        pagination: true, //是否开启分页
        pageNumber: 1, //默认索引页
        pageSize: 20, //默认一页数据条数
        rownumbers: true //行号
    });
}
function newUsere() {
    //清空内容  
    $('#fme').form('clear');
    $('#dlge').dialog('open').dialog('setTitle', '添加');
    document.getElementById("teste").value = "add";

}

//修改管理员  
function editUsere() {

    var row = $('#tte').datagrid('getSelected');
    if (row == null) {
        $.messager.alert("提示", "请选择要修改的行！", "info");
    }
    if (row) {
        $('#dlge').dialog('open').dialog('setTitle', '修改');

        document.getElementById("teste").value = "modify";
        $('#fme').form('load', row);
    }
}
//添加        
function saveUsere() {
    var test = document.getElementById("teste").value;
    var f = $('#fme');
    if (test == "add") {
        f.form('submit', {
            url: "GetEdu.ashx?pid=" + pid + "&action=" + test,
            onSubmit: function () {
                return $(this).form('validate');
            },
            success: function (result) {
                if (result.indexOf("T") == 0) {
                    $('#dlge').dialog('close');
                    $.messager.alert("提示", "恭喜您，信息添加成功", "info");
                    $('#tte').datagrid('reload');
                }
                else if ((result.indexOf("F") == 0)) {
                    $.messager.alert("提示", "添加失败，请重新操作！", "info");
                    return;
                }
                else if ((result.indexOf("L") == 0)) {
                    $.messager.alert("提示", "长时间没有操作，请重新登录！", "info");
                    top.location = '/Default.aspx';
                    return;
                }
            }
        });

    } else {

        $('#fme').form('submit', {
            url: "GetEdu.ashx?action=" + test,
            onSubmit: function () {
                return $(this).form('validate');
            },
            success: function (result) {
                if (result.indexOf("T") == 0) {
                    $('#dlge').dialog('close');
                    $('#tte').datagrid('clearSelections');
                    $.messager.alert("提示", "恭喜您，信息修改成功", "info");
                    $('#tte').datagrid('reload');

                }
                else if ((result.indexOf("F") == 0)) {
                    $.messager.alert("提示", "添加失败，请重新操作！", "info");
                    return;
                }
                else if ((result.indexOf("L") == 0)) {
                    $.messager.alert("提示", "长时间没有操作，请重新登录！", "info");
                    top.location = '/Default.aspx';
                    return;
                }
            }
        });
    }
}
function removeUsere() {
    var test = document.getElementById("teste").value = "delete";
    var row = $('#tte').datagrid('getSelected');
    if (row == null) {
        $.messager.alert("提示", "请选择要删除的行！", "info");
    }
    if (row) {
        $.messager.confirm('提示', '你确定要删除这条信息吗？', function (r) {
            if (r) {
                $('#fme').form('submit', {
                    url: 'GetEdu.ashx?uid=' + row.eid + "&action=" + test,
                    onSubmit: function () {
                        //return $(this).form('validate');  
                    },
                    success: function (result) {
                        if (result.indexOf("T") == 0) {
                            $('#dlge').dialog('close');
                            $('#tte').datagrid('clearSelections'); //清空选中的行  
                            $.messager.alert("提示", "恭喜您，信息删除成功！", "info");
                            $('#tte').datagrid('reload');
                        }
                        else if ((result.indexOf("F") == 0)) {
                            $.messager.alert("提示", "删除失败，请重新操作！", "info");
                            return;
                        }
                        else if ((result.indexOf("L") == 0)) {
                            $.messager.alert("提示", "长时间没有操作，请重新登录！", "info");
                            top.location = '/Default.aspx';
                            return;
                        }
                    }
                });
            }
        })
    }
}

function InitGirdf() {
    $('#ttf').datagrid({
        //title: '工作经历列表', //表格标题
        url: 'GetF.ashx', //请求数据的页面
        sortName: 'inputtime', //排序字段
        idField: 'fid', //标识字段,主键
        iconCls: '', //标题左边的图标
        width: '100%', //宽度
        height: '100%',
        nowrap: false, //是否换行，True 就会把数据显示在一行里
        striped: true, //True 奇偶行使用不同背景色
        collapsible: false, //可折叠
        sortOrder: 'desc', //排序类型
        remoteSort: true, //定义是否从服务器给数据排序
        fitColumns: true,
        singleSelect: true,
        method: 'post',
        columns: [[
            { field: 'ckb', checkbox: true },
            { title: '家庭成员姓名', field: 'fname', width: 150 },
            { title: '与本人的关系', field: 'frelation', width: 150 },
            { title: '工作单位及职务', field: 'fwork', width: 80 }
        ]],
        toolbar: "#tab_toolbarf",
        queryParams: { "action": "query", "pid": pid },
        pagination: true, //是否开启分页
        pageNumber: 1, //默认索引页
        pageSize: 20, //默认一页数据条数
        rownumbers: true //行号
    });
}
function newUserf() {
    //清空内容  
    $('#fmf').form('clear');
    $('#dlgf').dialog('open').dialog('setTitle', '添加');
    document.getElementById("testf").value = "add";

}

//修改管理员  
function editUserf() {

    var row = $('#ttf').datagrid('getSelected');
    if (row == null) {
        $.messager.alert("提示", "请选择要修改的行！", "info");
    }
    if (row) {
        $('#dlgf').dialog('open').dialog('setTitle', '修改');

        document.getElementById("testf").value = "modify";
        $('#fmf').form('load', row);
    }
}
//添加        
function saveUserf() {
    var test = document.getElementById("testf").value;
    var f = $('#fmf');
    if (test == "add") {
        f.form('submit', {
            url: "GetF.ashx?pid=" + pid + "&action=" + test,
            onSubmit: function () {
                return $(this).form('validate');
            },
            success: function (result) {
                if (result.indexOf("T") == 0) {
                    $('#dlgf').dialog('close');
                    $.messager.alert("提示", "恭喜您，信息添加成功", "info");
                    $('#ttf').datagrid('reload');
                }
                else if ((result.indexOf("F") == 0)) {
                    $.messager.alert("提示", "添加失败，请重新操作！", "info");
                    return;
                }
                else if ((result.indexOf("L") == 0)) {
                    $.messager.alert("提示", "长时间没有操作，请重新登录！", "info");
                    top.location = '/Default.aspx';
                    return;
                }
            }
        });

    } else {

        $('#fmf').form('submit', {
            url: "GetF.ashx?action=" + test,
            onSubmit: function () {
                return $(this).form('validate');
            },
            success: function (result) {
                if (result.indexOf("T") == 0) {
                    $('#dlgf').dialog('close');
                    $('#ttf').datagrid('clearSelections');
                    $.messager.alert("提示", "恭喜您，信息修改成功", "info");
                    $('#ttf').datagrid('reload');

                }
                else if ((result.indexOf("F") == 0)) {
                    $.messager.alert("提示", "添加失败，请重新操作！", "info");
                    return;
                }
                else if ((result.indexOf("L") == 0)) {
                    $.messager.alert("提示", "长时间没有操作，请重新登录！", "info");
                    top.location = '/Default.aspx';
                    return;
                }
            }
        });
    }
}
function removeUserf() {
    var test = document.getElementById("testf").value = "delete";
    var row = $('#ttf').datagrid('getSelected');
    if (row == null) {
        $.messager.alert("提示", "请选择要删除的行！", "info");
    }
    if (row) {
        $.messager.confirm('提示', '你确定要删除这条信息吗？', function (r) {
            if (r) {
                $('#fmf').form('submit', {
                    url: 'GetF.ashx?uid=' + row.fid + "&action=" + test,
                    onSubmit: function () {
                        //return $(this).form('validate');  
                    },
                    success: function (result) {
                        if (result.indexOf("T") == 0) {
                            $('#dlgf').dialog('close');
                            $('#ttf').datagrid('clearSelections'); //清空选中的行  
                            $.messager.alert("提示", "恭喜您，信息删除成功！", "info");
                            $('#ttf').datagrid('reload');
                        }
                        else if ((result.indexOf("F") == 0)) {
                            $.messager.alert("提示", "删除失败，请重新操作！", "info");
                            return;
                        }
                        else if ((result.indexOf("L") == 0)) {
                            $.messager.alert("提示", "长时间没有操作，请重新登录！", "info");
                            top.location = '/Default.aspx';
                            return;
                        }
                    }
                });
            }
        })
    }
}
function InitGirdr() {
    $('#ttr').datagrid({
        //title: '工作经历列表', //表格标题
        url: 'GetR.ashx', //请求数据的页面
        sortName: 'inputtime', //排序字段
        idField: 'rid', //标识字段,主键
        iconCls: '', //标题左边的图标
        width: '100%', //宽度
        height: '100%',
        nowrap: false, //是否换行，True 就会把数据显示在一行里
        striped: true, //True 奇偶行使用不同背景色
        collapsible: false, //可折叠
        sortOrder: 'desc', //排序类型
        remoteSort: true, //定义是否从服务器给数据排序
        fitColumns: true,
        singleSelect: true,
        method: 'post',
        columns: [[
            { field: 'ckb', checkbox: true },
            { title: '奖励名称', field: 'rname', width: 150 },
            {
                title: '奖励批准时间', field: 'rdate', width: 100, formatter: function (value, row, index) {
                    if (value != "") {

                        if (value.indexOf("-") != -1)
                            value = value.replace(/-/g, "/");
                        return new Date(value).pattern("yyyy年M月d日");
                    }
                }
            },
            { title: '批准单位名称', field: 'rdw', width: 150 }

        ]],
        toolbar: "#tab_toolbarr",
        queryParams: { "action": "query", "pid": pid },
        pagination: true, //是否开启分页
        pageNumber: 1, //默认索引页
        pageSize: 20, //默认一页数据条数
        rownumbers: true //行号
    });
}
function newUserr() {
    //清空内容  
    $('#fmr').form('clear');
    $('#dlgr').dialog('open').dialog('setTitle', '添加');
    document.getElementById("testr").value = "add";

}

//修改管理员  
function editUserr() {

    var row = $('#ttr').datagrid('getSelected');
    if (row == null) {
        $.messager.alert("提示", "请选择要修改的行！", "info");
    }
    if (row) {
        $('#dlgr').dialog('open').dialog('setTitle', '修改');

        document.getElementById("testr").value = "modify";
        $('#fmr').form('load', row);
    }
}
//添加        
function saveUserr() {
    var test = document.getElementById("testr").value;
    var f = $('#fmr');
    if (test == "add") {
        f.form('submit', {
            url: "GetR.ashx?pid=" + pid + "&action=" + test,
            onSubmit: function () {
                return $(this).form('validate');
            },
            success: function (result) {
                if (result.indexOf("T") == 0) {
                    $('#dlgr').dialog('close');
                    $.messager.alert("提示", "恭喜您，信息添加成功", "info");
                    $('#ttr').datagrid('reload');
                }
                else if ((result.indexOf("F") == 0)) {
                    $.messager.alert("提示", "添加失败，请重新操作！", "info");
                    return;
                }
                else if ((result.indexOf("L") == 0)) {
                    $.messager.alert("提示", "长时间没有操作，请重新登录！", "info");
                    top.location = '/Default.aspx';
                    return;
                }
            }
        });

    } else {

        $('#fmr').form('submit', {
            url: "GetR.ashx?action=" + test,
            onSubmit: function () {
                return $(this).form('validate');
            },
            success: function (result) {
                if (result.indexOf("T") == 0) {
                    $('#dlgr').dialog('close');
                    $('#ttr').datagrid('clearSelections');
                    $.messager.alert("提示", "恭喜您，信息修改成功", "info");
                    $('#ttr').datagrid('reload');

                }
                else if ((result.indexOf("F") == 0)) {
                    $.messager.alert("提示", "添加失败，请重新操作！", "info");
                    return;
                }
                else if ((result.indexOf("L") == 0)) {
                    $.messager.alert("提示", "长时间没有操作，请重新登录！", "info");
                    top.location = '/Default.aspx';
                    return;
                }
            }
        });
    }
}
function removeUserr() {
    var test = document.getElementById("testr").value = "delete";
    var row = $('#ttr').datagrid('getSelected');
    if (row == null) {
        $.messager.alert("提示", "请选择要删除的行！", "info");
    }
    if (row) {
        $.messager.confirm('提示', '你确定要删除这条信息吗？', function (r) {
            if (r) {
                $('#fmr').form('submit', {
                    url: 'GetR.ashx?uid=' + row.rid + "&action=" + test,
                    onSubmit: function () {
                        //return $(this).form('validate');  
                    },
                    success: function (result) {
                        if (result.indexOf("T") == 0) {
                            $('#dlgr').dialog('close');
                            $('#ttr').datagrid('clearSelections'); //清空选中的行  
                            $.messager.alert("提示", "恭喜您，信息删除成功！", "info");
                            $('#ttr').datagrid('reload');
                        }
                        else if ((result.indexOf("F") == 0)) {
                            $.messager.alert("提示", "删除失败，请重新操作！", "info");
                            return;
                        }
                        else if ((result.indexOf("L") == 0)) {
                            $.messager.alert("提示", "长时间没有操作，请重新登录！", "info");
                            top.location = '/Default.aspx';
                            return;
                        }
                    }
                });
            }
        })
    }
}
function InitGirdpu() {
    $('#ttpu').datagrid({
        //title: '工作经历列表', //表格标题
        url: 'GetPu.ashx', //请求数据的页面
        sortName: 'inputtime', //排序字段
        idField: 'puid', //标识字段,主键
        iconCls: '', //标题左边的图标
        width: '100%', //宽度
        height: '100%',
        nowrap: false, //是否换行，True 就会把数据显示在一行里
        striped: true, //True 奇偶行使用不同背景色
        collapsible: false, //可折叠
        sortOrder: 'desc', //排序类型
        remoteSort: true, //定义是否从服务器给数据排序
        fitColumns: true,
        singleSelect: true,
        method: 'post',
        columns: [[
            { field: 'ckb', checkbox: true },
            { title: '处分名称', field: 'pname', width: 150 },
            {
                title: '处分批准时间', field: 'pdate', width: 100, formatter: function (value, row, index) {
                    if (value != "") {

                        if (value.indexOf("-") != -1)
                            value = value.replace(/-/g, "/");
                        return new Date(value).pattern("yyyy年M月d日");
                    }
                }
            },
            { title: '批准单位名称', field: 'pdw', width: 150 }

        ]],
        toolbar: "#tab_toolbarpu",
        queryParams: { "action": "query", "pid": pid },
        pagination: true, //是否开启分页
        pageNumber: 1, //默认索引页
        pageSize: 20, //默认一页数据条数
        rownumbers: true //行号
    });
}
function newUserpu() {
    //清空内容  
    $('#fmpu').form('clear');
    $('#dlgpu').dialog('open').dialog('setTitle', '添加');
    document.getElementById("testpu").value = "add";

}

//修改管理员  
function editUserpu() {

    var row = $('#ttpu').datagrid('getSelected');
    if (row == null) {
        $.messager.alert("提示", "请选择要修改的行！", "info");
    }
    if (row) {
        $('#dlgpu').dialog('open').dialog('setTitle', '修改');

        document.getElementById("testpu").value = "modify";
        $('#fmpu').form('load', row);
    }
}
//添加        
function saveUserpu() {
    var test = document.getElementById("testpu").value;
    var f = $('#fmpu');
    if (test == "add") {
        f.form('submit', {
            url: "GetPu.ashx?pid=" + pid + "&action=" + test,
            onSubmit: function () {
                return $(this).form('validate');
            },
            success: function (result) {
                if (result.indexOf("T") == 0) {
                    $('#dlgpu').dialog('close');
                    $.messager.alert("提示", "恭喜您，信息添加成功", "info");
                    $('#ttpu').datagrid('reload');
                }
                else if ((result.indexOf("F") == 0)) {
                    $.messager.alert("提示", "添加失败，请重新操作！", "info");
                    return;
                }
                else if ((result.indexOf("L") == 0)) {
                    $.messager.alert("提示", "长时间没有操作，请重新登录！", "info");
                    top.location = '/Default.aspx';
                    return;
                }
            }
        });

    } else {

        $('#fmpu').form('submit', {
            url: "GetPu.ashx?action=" + test,
            onSubmit: function () {
                return $(this).form('validate');
            },
            success: function (result) {
                if (result.indexOf("T") == 0) {
                    $('#dlgpu').dialog('close');
                    $('#ttpu').datagrid('clearSelections');
                    $.messager.alert("提示", "恭喜您，信息修改成功", "info");
                    $('#ttpu').datagrid('reload');

                }
                else if ((result.indexOf("F") == 0)) {
                    $.messager.alert("提示", "添加失败，请重新操作！", "info");
                    return;
                }
                else if ((result.indexOf("L") == 0)) {
                    $.messager.alert("提示", "长时间没有操作，请重新登录！", "info");
                    top.location = '/Default.aspx';
                    return;
                }
            }
        });
    }
}
function removeUserpu() {
    var test = document.getElementById("testpu").value = "delete";
    var row = $('#ttpu').datagrid('getSelected');
    if (row == null) {
        $.messager.alert("提示", "请选择要删除的行！", "info");
    }
    if (row) {
        $.messager.confirm('提示', '你确定要删除这条信息吗？', function (r) {
            if (r) {
                $('#fmpu').form('submit', {
                    url: 'GetPu.ashx?uid=' + row.puid + "&action=" + test,
                    onSubmit: function () {
                        //return $(this).form('validate');  
                    },
                    success: function (result) {
                        if (result.indexOf("T") == 0) {
                            $('#dlgpu').dialog('close');
                            $('#ttpu').datagrid('clearSelections'); //清空选中的行  
                            $.messager.alert("提示", "恭喜您，信息删除成功！", "info");
                            $('#ttpu').datagrid('reload');
                        }
                        else if ((result.indexOf("F") == 0)) {
                            $.messager.alert("提示", "删除失败，请重新操作！", "info");
                            return;
                        }
                        else if ((result.indexOf("L") == 0)) {
                            $.messager.alert("提示", "长时间没有操作，请重新登录！", "info");
                            top.location = '/Default.aspx';
                            return;
                        }
                    }
                });
            }
        })
    }
}
function InitGirdt() {
    $('#tttr').datagrid({
        //title: '工作经历列表', //表格标题
        url: 'GetT.ashx', //请求数据的页面
        sortName: 'inputtime', //排序字段
        idField: 'tid', //标识字段,主键
        iconCls: '', //标题左边的图标
        width: '100%', //宽度
        height: '100%',
        nowrap: false, //是否换行，True 就会把数据显示在一行里
        striped: true, //True 奇偶行使用不同背景色
        collapsible: false, //可折叠
        sortOrder: 'desc', //排序类型
        remoteSort: true, //定义是否从服务器给数据排序
        fitColumns: true,
        singleSelect: true,
        method: 'post',
        columns: [[
            { field: 'ckb', checkbox: true },
            {
                title: '开始时间', field: 'sdate', width: 80, formatter: function (value, row, index) {
                    if (value != "") {

                        if (value.indexOf("-") != -1)
                            value = value.replace(/-/g, "/");
                        return new Date(value).pattern("yyyy年M月d日");
                    }
                }
            },
            {
                title: '结束时间', field: 'edate', width: 80, formatter: function (value, row, index) {
                    if (value != "") {

                        if (value.indexOf("-") != -1)
                            value = value.replace(/-/g, "/");
                        return new Date(value).pattern("yyyy年M月d日");
                    }
                }
            },
            { title: '培训班名称', field: 'tname', width: 150 },
            { title: '培训主办单位名称', field: 'tzbdw', width: 150 }
        ]],
        toolbar: "#tab_toolbart",
        queryParams: { "action": "query", "pid": pid },
        pagination: true, //是否开启分页
        pageNumber: 1, //默认索引页
        pageSize: 20, //默认一页数据条数
        rownumbers: true //行号
    });
}
function newUsert() {
    //清空内容  
    $('#fmt').form('clear');
    $('#dlgt').dialog('open').dialog('setTitle', '添加');
    document.getElementById("testt").value = "add";

}

//修改管理员  
function editUsert() {

    var row = $('#tttr').datagrid('getSelected');
    if (row == null) {
        $.messager.alert("提示", "请选择要修改的行！", "info");
    }
    if (row) {
        $('#dlgt').dialog('open').dialog('setTitle', '修改');
        //$('#wid').val(row.uid);
        document.getElementById("testt").value = "modify";
        $('#fmt').form('load', row);
    }
}
//添加        
function saveUsert() {
    var test = document.getElementById("testt").value;
    var f = $('#fmt');
    if (test == "add") {
        f.form('submit', {
            url: "GetT.ashx?pid=" + pid + "&action=" + test,
            onSubmit: function () {
                return $(this).form('validate');
            },
            success: function (result) {
                if (result.indexOf("T") == 0) {
                    $('#dlgt').dialog('close');
                    $.messager.alert("提示", "恭喜您，信息添加成功", "info");
                    $('#tttr').datagrid('reload');
                }
                else if ((result.indexOf("F") == 0)) {
                    $.messager.alert("提示", "添加失败，请重新操作！", "info");
                    return;
                }
                else if ((result.indexOf("L") == 0)) {
                    $.messager.alert("提示", "长时间没有操作，请重新登录！", "info");
                    top.location = '/Default.aspx';
                    return;
                }
            }
        });

    } else {

        $('#fmt').form('submit', {
            url: "GetT.ashx?action=" + test,
            onSubmit: function () {
                return $(this).form('validate');
            },
            success: function (result) {
                if (result.indexOf("T") == 0) {
                    $('#dlgt').dialog('close');
                    $('#tttr').datagrid('clearSelections');
                    $.messager.alert("提示", "恭喜您，信息修改成功", "info");
                    $('#tttr').datagrid('reload');

                }
                else if ((result.indexOf("F") == 0)) {
                    $.messager.alert("提示", "添加失败，请重新操作！", "info");
                    return;
                }
                else if ((result.indexOf("L") == 0)) {
                    $.messager.alert("提示", "长时间没有操作，请重新登录！", "info");
                    top.location = '/Default.aspx';
                    return;
                }
            }
        });
    }
}
function removeUsert() {
    var test = document.getElementById("testt").value = "delete";
    var row = $('#tttr').datagrid('getSelected');
    if (row == null) {
        $.messager.alert("提示", "请选择要删除的行！", "info");
    }
    if (row) {
        $.messager.confirm('提示', '你确定要删除这条信息吗？', function (r) {
            if (r) {
                $('#fmt').form('submit', {
                    url: 'GetT.ashx?uid=' + row.tid + "&action=" + test,
                    onSubmit: function () {
                        //return $(this).form('validate');  
                    },
                    success: function (result) {
                        if (result.indexOf("T") == 0) {
                            $('#dlgt').dialog('close');
                            $('#tttr').datagrid('clearSelections'); //清空选中的行  
                            $.messager.alert("提示", "恭喜您，信息删除成功！", "info");
                            //alert('恭喜您，信息删除成功！')  
                            // close the dialog  
                            $('#tttr').datagrid('reload');
                            //$('#fm').form('submit');

                        }
                        else if ((result.indexOf("F") == 0)) {
                            $.messager.alert("提示", "删除失败，请重新操作！", "info");
                            return;
                        }
                        else if ((result.indexOf("L") == 0)) {
                            $.messager.alert("提示", "长时间没有操作，请重新登录！", "info");
                            top.location = '/Default.aspx';
                            return;
                        }

                    }

                });
            }
        })
    }
}
function getChecked() {
    var nodes = $('#ttku').tree('getChecked');
    var s = '';
    for (var i = 0; i < nodes.length; i++) {
        if ($('#ttku').tree('isLeaf', nodes[i].target)) {//判断是否是叶子节点
            if (s != '') s += ',';
            s += nodes[i].id;
        }
    }
    return s;
}
function InitTree() {
    $('#pku').panel({
        height: '100%',
        title: '库信息'
    });
    $('#ttku').tree({
        url: '../kuinfo/GetKu.ashx?pid=0', //请求数据的页面               
        lines: true,
        height: '100%',
        method: 'post',
        checkbox: true,
        onlyLeafCheck: true,
        queryParams: { "action": "queryybk" },
        onBeforeExpand: function (node, param) {
            $('#ttku').tree('options').url = "../kuinfo/GetKu.ashx?pid=" + node.id;
        },
        onLoadSuccess: function (node, data) {
            //if (selectNode) {
            //    $('#ttku').tree('collapseAll');
            //    var nodeNew = $('#tt').tree('find', selectNode.id);
            //    $('#ttku').tree('expandTo', nodeNew.target);
            //    $('#ttku').tree('expand', nodeNew.target);
            //    $('#ttku').tree('scrollTo', nodeNew.target);
            //}
            //else
            //    $('#ttku').tree('collapseAll');

        }
    });
}

function saveUserku() {
    var f = $('#fmku');
    var kid = getChecked();
    $('#kuid').val(kid);
    f.form('submit', {
        url: "../kuinfo/GetKu.ashx?pid=" + pid + "&action=addmyuid",
        onSubmit: function () {
            return $(this).form('validate');
        },
        success: function (result) {
            if (result.indexOf("T") == 0) {
                $('#dlgt').dialog('close');
                $.messager.alert("提示", "恭喜您，设置成功", "info");
                $('#tt').datagrid('reload');
            }
            else if ((result.indexOf("F") == 0)) {
                $.messager.alert("提示", "添加失败，请重新操作！", "info");
                return;
            }
            else if ((result.indexOf("L") == 0)) {
                $.messager.alert("提示", "长时间没有操作，请重新登录！", "info");
                top.location = '/Default.aspx';
                return;
            }
        }
    });

}
function InitPictype() {
    $('#ptid').combobox({
        url: '/pictypeinfo/GetPt.ashx?action=ddllist',
        valueField: 'ptid',
        textField: 'ptname',
        panelHeight: 'auto'
    });
}
function InitGirdpic() {
    $('#showpic').hide();
    $('#ttpic').tree({
        //title: '工作经历列表', //表格标题
        url: 'GetPic.ashx', //请求数据的页面        
        width: '100%', //宽度
        height: '100%',
        lines: true,
        method: 'post',

        queryParams: { "action": "querytree", "pid": pid },
        onSelect: function (node) {
            if (node.type == '1') {
                $('#showpic').attr('src', node.bm);
                $('#showpic').show();
            }
            else {
                $('#showpic').hide();
            }

        }
    });
}
function newUserpic() {
    //清空内容  
    $('#fmpic').form('clear');
    $('#dlgpic').dialog('open').dialog('setTitle', '添加');
    document.getElementById("testpic").value = "add";

}

//修改管理员  
function editUserpic() {

    var row = $('#ttpic').tree('getSelected');
    if (row == null) {
        $.messager.alert("提示", "请选择要修改的图片！", "info");
        return;
    }
    if (row.type == '2') {
        $.messager.alert("提示", "请选择要修改的图片！", "info");
        return;
    }

    if (row) {
        $('#dlgpic').dialog('open').dialog('setTitle', '修改');
        document.getElementById("testpic").value = "modify";
        //$('#fmpic').form('load', row);
        $('#htpic').val(row.bm);
        $('#picid').val(row.id);
        $('#picname').val(row.text);
        $('#ptid').combobox('setValue', row.ptid);
    }
}
//添加        
function saveUserpic() {
    var test = document.getElementById("testpic").value;
    var f = $('#fmpic');
    if (test == "add") {
        f.form('submit', {
            url: "GetPic.ashx?pid=" + pid + "&action=" + test,
            onSubmit: function () {
                return $(this).form('validate');
            },
            success: function (result) {
                if (result.indexOf("T") == 0) {
                    $('#dlgpic').dialog('close');
                    $.messager.alert("提示", "恭喜您，信息添加成功", "info");
                    $('#ttpic').tree('reload');
                }
                else if ((result.indexOf("F") == 0)) {
                    $.messager.alert("提示", "添加失败，请重新操作！", "info");
                    return;
                }
                else if ((result.indexOf("L") == 0)) {
                    $.messager.alert("提示", "长时间没有操作，请重新登录！", "info");
                    top.location = '/Default.aspx';
                    return;
                }
            }
        });

    } else {

        $('#fmpic').form('submit', {
            url: "GetPic.ashx?action=" + test,
            onSubmit: function () {
                return $(this).form('validate');
            },
            success: function (result) {
                if (result.indexOf("T") == 0) {
                    $('#dlgpic').dialog('close');
                    $.messager.alert("提示", "恭喜您，信息修改成功", "info");
                    $('#ttpic').tree('reload');

                }
                else if ((result.indexOf("F") == 0)) {
                    $.messager.alert("提示", "添加失败，请重新操作！", "info");
                    return;
                }
                else if ((result.indexOf("L") == 0)) {
                    $.messager.alert("提示", "长时间没有操作，请重新登录！", "info");
                    top.location = '/Default.aspx';
                    return;
                }
            }
        });
    }
}
function removeUserpic() {
    var test = document.getElementById("testpic").value = "delete";
    var row = $('#ttpic').tree('getSelected');
    if (row == null) {
        $.messager.alert("提示", "请选择要修改的图片！", "info");
        return;
    }
    if (row.type == '2') {
        $.messager.alert("提示", "请选择要修改的图片！", "info");
        return;
    }
    if (row) {
        $.messager.confirm('提示', '你确定要删除这条信息吗？', function (r) {
            if (r) {
                $('#fmpic').form('submit', {
                    url: 'GetPic.ashx?uid=' + row.id + "&action=" + test,
                    onSubmit: function () {
                        //return $(this).form('validate');  
                    },
                    success: function (result) {
                        if (result.indexOf("T") == 0) {
                            $('#dlgpic').dialog('close');

                            $.messager.alert("提示", "恭喜您，信息删除成功！", "info");
                            //alert('恭喜您，信息删除成功！')  
                            // close the dialog  
                            $('#ttpic').tree('reload');
                            //$('#fm').form('submit');

                        }
                        else if ((result.indexOf("F") == 0)) {
                            $.messager.alert("提示", "删除失败，请重新操作！", "info");
                            return;
                        }
                        else if ((result.indexOf("L") == 0)) {
                            $.messager.alert("提示", "长时间没有操作，请重新登录！", "info");
                            top.location = '/Default.aspx';
                            return;
                        }

                    }

                });
            }
        })
    }
}
function importUser() {
    //清空内容  
    $('#fmimport').form('clear');
    $('#dlgimport').dialog('open').dialog('setTitle', '导入');
}
function saveimportUser() {
    var f = $('#fmimport');
    f.form('submit', {
        url: "GetP.ashx?action=import",
        onSubmit: function () {
            return $(this).form('validate');
        },
        success: function (result) {
            var parter = /(\\n+)/g;
            result = result.replace(parter, "<br/>");
            $('#dlgimport').dialog('close');
            $.messager.alert("提示", result, "info");
            $('#tt').datagrid('reload');
        }
    });
}
function opendagxdl(rpid, pname) {
    pid = rpid;
    $('#dlggx').dialog('open').dialog('setTitle', pname + '档案关系代理情况');
    InitGX(pid);
}
function InitGX(pid) {
    $('#gxtitle').panel({
        height: '100%',
        title: '档案关系代理信息'
    });
    $('#gxpid').val(pid);

    $.ajax({
        type: "POST",          // 通过request.term可以获得文本框内容   
        url: "GetP.ashx?action=getdagx&pid=" + pid,
        contentType: "application/json; charset=gb2312",
        dataType: "json",
        success: function (data) {

            var drelation = data[0].drelation;
            var hrelation = data[0].hrelation;
            var sbrelation = data[0].sbrelation;

            if (drelation == "0") {

                $("#drelation1").prop("checked", false);
                $("#drelation0").prop("checked", true);

            }
            else {

                $("#drelation1").prop("checked", true);
                $("#drelation0").prop("checked", false);

            }

            if (hrelation == "0") {
                $("#hrelation1").prop("checked", false);
                $("#hrelation0").prop("checked", true);
            }
            else {
                $("#hrelation1").prop("checked", true);
                $("#hrelation0").prop("checked", false);
            }

            if (sbrelation == "0") {
                $("#sbrelation1").prop("checked", false);
                $("#sbrelation0").prop("checked", true);
            }
            else {
                $("#sbrelation1").prop("checked", true);
                $("#sbrelation0").prop("checked", false);
            }

        },
        error: function () {
            alert("ajax请求失败");
        }
    });
}
//修改档案关系情况
function saveGX() {

    var pid = $('#gxpid').val();
    var dr = $('input:radio[name="drelation"]:checked').val();;
    var hr = $('input:radio[name="hrelation"]:checked').val();;
    var sr = $('input:radio[name="sbrelation"]:checked').val();;



    var f = $('#fmgx');
    f.form('submit', {
        url: "GetP.ashx?action=modifygx&pid=" + pid + "&dr=" + dr + "&hr=" + hr + "&sr=" + sr,
        onSubmit: function () {
            //return $(this).form('validate');
            return true;
        },
        success: function (result) {
            if (result.indexOf("T") == 0) {
                $('#dlg').dialog('close');
                $('#tt').datagrid('clearSelections');
                $.messager.alert("提示", "恭喜您，信息修改成功", "info");
                $('#tt').datagrid('reload');

            }
            else if ((result.indexOf("F") == 0)) {
                $.messager.alert("提示", "添加失败，请重新操作！", "info");
                return;
            }
            else if ((result.indexOf("L") == 0)) {
                $.messager.alert("提示", "长时间没有操作，请重新登录！", "info");
                top.location = '/Default.aspx';
                return;
            }
        }
    });

}
